# NumPy ndarray对象

import numpy as np
a=np.array([1,2,3]) # 使用列表构建一维数组
print(a)
# [1 2 3]
print(type(a))
# ndarray数组类型
# <class 'numpy.ndarray'>

b=np.array([[1,2,3],[4,5,6]])
print(b)
# [[1 2 3]
# [4 5 6]]

c=np.array([2,4,6,8],dtype="complex")
print(c)
# [2.+0.j 4.+0.j 6.+0.j 8.+0.j]

arr = np.array([[1, 2, 3, 4], [4, 5, 6, 7], [9, 10, 11, 23]]) 
print(arr.ndim) 
# 2

#输出一个二维数组
# d = np.array([[1, 2, 3,4,5]], ndim = 2)
# print(d)

e = np.array([[1,2],[3,4],[5,6]]) 
print("原数组",e) 
e=e.reshape(2,3) 
print("新数组",e)  